#ifndef UUID_69DAB77521EE4E36D7E709A2B488C771
#define UUID_69DAB77521EE4E36D7E709A2B488C771

typedef struct bytewriter_
{
	int message_ends;
	unsigned char* next;
	unsigned char* end;
	void* user;

	void (*overflow)(struct bytewriter_* self, int b);
	void (*flush)(struct bytewriter_* self);
	void (*destroy)(struct bytewriter_* self);
} bytewriter;

typedef struct bytereader_
{
	unsigned char const* next;
	unsigned char const* end;
	//int available_messages;
	//int section_message_ends; // Number of messages until we should discard the current section
	int next_unreceived_message;
	int next_complete_message_end;
	void* user;

	int (*underflow)(struct bytereader_* self);
	void (*update)(struct bytereader_* self);
	void (*destroy)(struct bytereader_* self);
} bytereader;

unsigned char bytereader_fix_underflow_(bytereader* s);

/* Overflow function that does nothing */
void bytewriter_overflow_dummy(bytewriter* w, int b);

void bytewriter_flush_dummy(bytewriter* w);

/* Underflow function that does nothing */
int bytereader_underflow_dummy(bytereader* r);

void bytereader_update_dummy(bytereader* r);

#include "byteio_inline.h"

#endif // UUID_69DAB77521EE4E36D7E709A2B488C771
